package WaiBao;

import java.util.Arrays;

public class ZhengZiHao {
    public static void main(String[] args) {
        String[] name = {"曹玉芬(班长)", "李绍普(副班长)", "小李(文艺委员)", "花一村(纪律委员)", "牌牌琦", "祁天道", "齐天建", "花百万", "大艺", "猫妹妹", "李志刚", "大紫",
                "徐金科", "张旭", "张永明", "扭跌为", "牛叠委", "刘先照", "张可可", "上官进", "李思源", "李茂贞", "李星云", "汪峰", "冯小刚", "刘志金", "王志文", "王劲松",
                "周冬雨", "郑子豪(学习委员)"};//考生本人:郑子豪(学习委员)
        int[] age = {18, 22, 20, 18, 22, 20, 19, 20, 21, 18, 18, 20, 20, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 20, 20};//考生本人年龄:20

        double[] manman1 = {74, 62, 76, 90, 90, 74, 78, 89, 81, 91, 91, 87, 85, 79, 65, 68, 99, 90, 86, 88, 92, 91, 95, 65, 75, 74, 94, 74, 80, 96};
        double[] manman2 = {76, 67, 65, 76, 80, 67, 64, 64, 73, 80, 92, 77, 66, 84, 65, 65, 76, 69, 76, 98, 72, 71, 95, 86, 75, 88, 84, 64, 81, 95};
        double[] manman3 = {67, 61, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 84, 95};

        double dili1 ;//代表每个学生的总分
        double dili2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            dili1  = manman1[i] + manman2[i] + manman3[i];
//            dili2 = (dili1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + dili1);
//            System.out.println(name[i] + "的平均分为:" + dili2);
//        }


        double moshi1 = 0, moshi2 = 0;
        double[] zouma = new double[30];
//        for (int i = 0; i < 30; i++) {
//            moshi1= manman1[i] +  manman2[i] +  manman3[i];
//            moshi2 = (moshi1* 1.0) / 3;
//            zouma[i] = moshi2;
//        }
//
//        for (int i = 0; i < zouma.length - 1; i++) {
//            for (int j = 0; j <  zouma.length - i - 1; j++) {
//                if (zouma[j] <zouma[j + 1]) {
//                    double tep =  zouma[j];
//                    zouma[j] = zouma[j + 1];
//                    zouma[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( zouma[i]);
//        }


        double laji1 = 0,  laji2 = 0,laji3 = 0;//计算每门课的平均分
        double dada1 = 0,dada2 = 0, dada3 = 0;//计算每门课标准差
        double xiaoxiao1 = 0, xiaoxiao2 = 0, xiaoxiao3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < manman1.length; i++) {
            he +=manman1[i];
        }
        laji1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" + laji1);
        double Sum = 0;
        for (int i = 0; i < manman2.length; i++) {
            Sum +=manman2[i];
        }
        laji2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + laji2);
        double sum = 0;
        for (int i = 0; i <manman3.length; i++) {
            sum +=manman3[i];
        }
        laji3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + laji3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <manman1.length; i++) {
            c1 += (manman1[i] - laji1) * (manman1[i] - laji1);
        }
        dada1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + dada1);
        for (int i = 0; i < manman2.length; i++) {
            c2 += (manman2[i] - laji2) * (manman2[i] -laji2);
        }
        dada2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +dada2);

        for (int i = 0; i <manman3.length; i++) {
            c3 += (manman3[i] - laji3) * (manman3[i] -  laji3);
        }
        dada3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + dada3);
////////
//        Arrays.sort(manman1);
//        Arrays.sort(manman2);
//        Arrays.sort(manman3);
//        xiaoxiao1 = (manman1[15] +manman2[16]) * 1.0 / 2;
//        xiaoxiao2 = (manman2[15] +manman2[16]) * 1.0 / 2;
//        xiaoxiao3 = (manman3[15] + manman3[16]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  xiaoxiao1);
//        System.out.println("农业设施设计与制造的中位数为:" + xiaoxiao2);
//        System.out.println("园艺植物设施栽培学的中位数为:" + xiaoxiao3);







    }
}
